/////////////////////////////////////////////////
// Book of Angels
// (c) Copyright 2013 Edward Principe
// All Rights Reserved
////////////////////////////////////////////////
#ifndef STDEX_H
#define STDEX_H

#include <Windows.h>
#include <tchar.h>
#include "ex2.h"

///////////////////////////////////////////////
// Sev: Error Severity
///////////////////////////////////////////////
enum Sev
{
	SEV_MESSAGE,
	SEV_WARNING,
	SEV_ERROR,
	SEV_FATAL
};

///////////////////////////////////////////////
// StdEx: Base class for other exception
//        classes
///////////////////////////////////////////////
class StdEx : public Ex
{
protected: // Construction
	StdEx(Sev sev = SEV_MESSAGE) : Ex(), _sev(sev) {}

	StdEx(const StdEx& rhs) : Ex()
	{
		Copy(rhs);
	}

public: // Methods
#ifdef _UNICODE
	wstring MakeMsg(); // Makes an error message
#else
	string MakeMsg();
#endif

public: // Accessor methods
	Sev GetSev() const {return _sev;}

public: // Operators
	StdEx& operator = (const StdEx& rhs)
	{
		Copy(rhs);
		return *this;
	}

	StdEx& operator = (const Sev& sev)
	{
		if(&_sev == &sev)
			return *this;

		_sev = sev;

		return *this;
	}

protected: // Methods
	void Copy(const StdEx& rhs)
	{
		if(this == &rhs)
			return;

		_sev = rhs._sev;

		Ex::Copy(rhs);
	}
protected: // Attributes
	Sev _sev; // Error severity
};
#endif